<!doctype html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title><?=$title;?></title>
<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible">
<meta content="<?=$keywords;?>" name="keywords">
<meta content="<?=$description;?>" name="description">
<link type="text/css" href="<?=STATIC_URL;?>css/base.css" rev="stylesheet" rel="stylesheet">
<link type="text/css" href="<?=STATIC_URL;?>css/html.css" rev="stylesheet" rel="stylesheet">
<link href="<?=STATIC_URL;?>favicon.ico" type="image/x-icon" rel="icon" />
<link href="<?=STATIC_URL;?>favicon.ico" type="image/x-icon" rel="shortcut icon" />
<body>
<? include dirname(__FILE__).'/../com-header.tpl.php'; ?>
<!------------------------------------>

<div id="container">
  <div id="about_info">
    <div id="about_left">
      <div class="about_left_menu">
        <ul>
    <?php
        foreach($menus as $var => $item) {
            if($var == $method){
                ?><li class="selected"><?=$item;?></li><?php
            }else{
                ?><li><a href="/html/<?=$var;?>"><?=$item;?></a></li><?php
            }
        }
    ?>
        </ul>
      </div>
    </div>
    <div id="about_right">
      <div class="about_right_content">
        <div class="content_title">餐厅加盟</div>
        <p style="color:#C00">&nbsp; 请先填写下面联络信息，本站工作人员会尽快与您联系。咨询电话：400 0411 569 转 0</p>
        <p>&nbsp; </p>
        <form action="/html/applied" id="form1" method="post">
        <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#ffffff" class="applyform">
          <tr bgcolor="#EFEFEF">
            <th width="100">餐厅名称</th>
            <td><input name="shopname" type="text" id="shopname" value="" size="50"></td>
          </tr>
          <tr bgcolor="#F9F9F9">
            <th>所属区域</th>
            <td>
              <?=$cityname;?>&nbsp;
              <select id="zone_id" name="zone_id" class="ssel">
                <option value="0" selected="">请选择...</option>
              </select>
              <select id="subzone_id" name="subzone_id" class="ssel">
                <option value="0" selected="">请选择...</option>
              </select></td>
          </tr>
          <tr bgcolor="#EFEFEF">
            <th>详细地址</th>
            <td><input name="address" type="text" id="address" value="" size="50"></td>
          </tr>
          <tr bgcolor="#F9F9F9">
            <th>联 系 人</th>
            <td><input name="author" type="text" id="author" value=""></td>
          </tr>
          <tr bgcolor="#EFEFEF">
            <th>手机号码</th>
            <td><input name="contact" type="text" id="contact" value="" size="50">
              (请填写您常用的号码)</td>
          </tr>
          <tr bgcolor="#F9F9F9">
            <th>送餐电话</th>
            <td><input name="telphone" type="text" id="telphone" value="" size="50">
              (多个号码用逗号分隔)</td>
          </tr>
          <tr bgcolor="#EFEFEF">
            <th>是否送餐</th>
            <td>
              <input name="deliver" type="radio" id="deliver_1" value="1" checked> 送餐
              &nbsp;
              <input name="deliver" type="radio" id="deliver_0" value="0"> 不送餐</td>
          </tr>
          <tr bgcolor="#F9F9F9">
            <th>配送说明</th>
            <td><textarea name="description" id="description" cols="50" rows="6">送餐时间：
起送价格：0元
起送分数：1份
送餐区域：

其他说明：</textarea></td>
          </tr>
          <tr bgcolor="#EFEFEF">
            <th>其他信息</th>
            <td><textarea name="memo" id="memo" cols="50" rows="6"></textarea></td>
          </tr>
        </table>
        <p>&nbsp;</p>
        <p align="center"><button type="submit" class="submit">提交表单</button></p>
        <input type="hidden" name="dosubmit" value="yes" />
        <input type="hidden" name="isajax" value="1" />
        </form>
      </div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<!------------------------------------>
<? include dirname(__FILE__).'/../com-footer.tpl.php'; ?>

<script language="javascript" type="text/javascript" src="<?=STATIC_URL;?>js/jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript" src="<?=STATIC_URL;?>js/jquery.form.min.js"></script>
<script language="javascript" type="text/javascript">
function zone_select(obj, parent_id, select_id){
    parent_id = parseInt(parent_id);
    if(isNaN(parent_id) || parent_id == undefined) {
        parent_id = 0;
    }
    select_id = parseInt(select_id);
    if(isNaN(select_id) || select_id == undefined) {
        select_id = 0;
    }
    $.get(
        '/tools/zoneOption/1/?pid=' + parent_id + '&zid=' + select_id,
        function(result){
            $(obj).html('<option value="0" selected>请选择...</option>' + result);
        }
    );
}
function checkForm(){
    if($("#shopname").val() == ""){
        alert("餐厅名称没有填写");
        $("#shopname").focus();
        return false;
    }
    if($("#zone_id").val() == 0 || $("#subzone_id").val() == 0){
        alert("请选择餐厅所属区域");
        $("#zone_id").focus();
        return false;
    }
    if($("#address").val() == ""){
        alert("详细地址没有填写");
        $("#address").focus();
        return false;
    }
    if($("#author").val() == ""){
        alert("联系人没有填写");
        $("#author").focus();
        return false;
    }
    return true;
}
$(document).ready(function() {
    if($("#zone_id")){
        var zone_id    = 0;
        var subzone_id = 0;
        zone_select("#zone_id", 0, zone_id);
        if(zone_id >0){
            zone_select("#subzone_id", zone_id, subzone_id);
        }

        $('#zone_id').change(function(){
            zone_select("#subzone_id", $(this).val());
        });
    }

    $('#form1').submit(function() {
        // 提交表单
        $(this).ajaxSubmit({
            dataType:"json",
            beforeSubmit:checkForm,
            success:function(data){
                if(!data.error){
                    alert('操作成功！工作人员稍后会于您取得联系。');
                    $('#form1').resetForm();
                }else{
                    alert(data.message);
                }
            }
        });
        return false;
    });
});
</script>
</body>
</html>